package com.kly.domain.vo;

import cn.hutool.core.bean.BeanUtil;
import com.kly.domain.entity.PictureComment;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;

/**
 * 图片评论
 * @TableName picture_comment
 */
@Data
public class PictureCommentVO implements Serializable {
    /**
     * 评论ID
     */
    private Long id;

    /**
     * 关联图片ID
     */
    private Long pictureId;

    /**
     * 评论用户ID
     */
    private Long userId;

    /**
     * 评论内容
     */
    private String content;

    /**
     * 创建时间
     */
    private Date createTime;

    /**
     * 更新时间
     */
    private Date updateTime;

    /**
     * 用户信息
     */
    private UserVO userVO;

    /**
     * 评论点赞数
     */
    private Long thumbCount;

    /**
     * 是否点赞
     */
    private Boolean isThumb;


    private static final long serialVersionUID = 1L;


    /**
     * 将实体类转化为VO类
     * @param pictureComment
     * @return
     */
    public static PictureCommentVO objToVo(PictureComment pictureComment) {
        if (pictureComment == null) {
            return null;
        }
        return BeanUtil.copyProperties(pictureComment, PictureCommentVO.class);
    }

    /**
     * 将VO类转化为实体类
     * @param pictureCommentVO
     * @return
     */
    public static PictureComment voToObj(PictureCommentVO pictureCommentVO) {
        if (pictureCommentVO == null) {
            return null;
        }
        return BeanUtil.copyProperties(pictureCommentVO, PictureComment.class);
    }
}